﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
//using AplicacionMVC.Models;
using AplicacionMVC.VehiculoWS;


namespace AplicacionMVC.Controllers
{
    public class VehiculoController : Controller
    {
        VehiculoWS.VehiculoClient proxy = new VehiculoWS.VehiculoClient();
                
        //
        // GET: /Vehiculo/

        public ActionResult Index()
        {
            //return View(proxy.ListarVehiculos());
           
            return View();
        }

        //
        // GET: /Vehiculo/Details/5

        public ActionResult Details(int id)
        {
            //return View(proxy.ObtenerVehiculo(id));
            Vehiculo Model = proxy.ObtenerVehiculo(id);
            return View(Model);
           
        }

        //
        // GET: /Vehiculo/Create

        public ActionResult Create()
        {
            return View();
        } 

        //
        // POST: /Vehiculo/Create

        [HttpPost]
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

               // string nombre = (string)collection["Nombre"];
               // string correo = (string)collection["Correo"];
               // int sede = int.Parse(collection["Sede.Codigo"]);
               // proxy.CrearAsesor(nombre, correo, sede);
              
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
        
        //
        // GET: /Vehiculo/Edit/5
 
        public ActionResult Edit(int id)
        {
            return View();
            //return View(proxy.ObtenerVehiculo(id));
        }

        //
        // POST: /Vehiculo/Edit/5

        [HttpPost]
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
             //   string nombre = (string)collection["Nombre"];
             //   string correo = (string)collection["Correo"];
             //   int sede = int.Parse(collection["Sede.Codigo"]);
             //   proxy.ModificarAsesor(id, nombre, correo, sede);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }

        //
        // GET: /Vehiculo/Delete/5
 
        public ActionResult Delete(int id)
        {
            return View(proxy.ObtenerVehiculo(id));
        }

        //
        // POST: /Vehiculo/Delete/5

        [HttpPost]
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                //proxy.EliminarAsesor(id);
                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    }
}
